package controllers
import (
	"github.com/astaxie/beego"
)

type User struct {
	name string "form:'name'"
	Age int "form:'age'"
}

type GetUserController struct {
	beego.Controller //这里相当于继承beego.Controller
}

func (c *GetUserController) Get()  {
	u := User{}
	//err := c.ParseForm(&u)
	//if err != nil {
	//	c.Ctx.WriteString("you send data is " + u.Name)
	//}
	u.name = c.GetString("name")
	u.Age, _ = c.GetInt("age")
	//c.Ctx.WriteString(string(u))
}

//重写Get方法
func (c *GetUserController) NewGet() {
	c.Ctx.WriteString("NewGet you send data is " + c.GetString("data","no data"))

}

func (c *GetUserController) Post(){
	c.Ctx.WriteString("you request pos data is " + c.GetString("data", "no data"))
}